/* 处理文件上传
 * @Author: Leil 
 * @Date: 2018-08-24 16:05:14 
 * @Last Modified by: Leil
 * @Last Modified time: 2018-08-24 16:50:24
 */
const path = require('path')
module.exports = function (app) {
    // 图片上传
    app.post('/uploadImg', (req, res) => {
        // 获取上传后的图片的名称
        console.log(req.files.uploadImg.path.split(path.sep).pop())
        const imgName = req.files.uploadImg.path.split(path.sep).pop()
        let imgPath = '/upload/' + imgName
        res.send({
            imgPath: imgPath
        })
    })
}